package com.ycy.leetcode.dongtaiguihua;

import org.junit.Test;


public class PaLouTi {


  /*
  动态规划解决 爬楼梯 问题
   */
  @Test
  public void test() {
    System.out.println(fun(1));
    System.out.println(fun(2));
    System.out.println(fun(3));
    System.out.println(fun(4));
    System.out.println(fun(5));
  }

  /*
  f(1) = 1
  f(2) = 2
  f(3) = f(1) + f(2) 3
  .
  .
  .
   */
  public int fun(int n) {
    if (n == 1) return 1;
    if (n == 2) return 2;
    return fun(n-2)+ fun(n-1);
  }

}
